#include <SFML\Network.hpp>
#include <SFML\System.hpp>
#include <iostream>
#include <string>

const unsigned int locPort = 30273;
sf::IpAddress locIP = sf::IpAddress::getLocalAddress();
std::string locConnectionText = "Connected!";


int main()
{
	sf::TcpSocket socket;

	char connectionType;
	//char mode;
	char buffer[2000];
	std::size_t recieved;

	std::cout << "Enter (s) for server, Enter (c) for client" << std::endl;
	std::cin >> connectionType;

	if(connectionType = 's')
	{
		sf::TcpListener listener;
		listener.listen(locPort);
		listener.accept(socket);
	}
	else
	{
		socket.connect(locIP, locPort);
		locConnectionText += " -client";
	}

	socket.send(locConnectionText.c_str(), locConnectionText.size());

	socket.receive(buffer, sizeof(buffer), recieved);

	std::cout << buffer << std::endl;

	system("pause");

	return 0;
}